/* eslint-disable jsdoc/no-restricted-syntax */
"use strict";

/**
 * @param {string} source
 * @returns {*}
 */
module.exports = function (source) {
  // Use a regular expression to match the stringWithMetadata function calls
  const regex = /stringWithMetadata\(['"]([^'"]+)['"],\s*\{[^}]*\}\)/g;

  // Replace all matches with just the string value
  const transformedSource = source.replaceAll(regex, (match, p1) =>
    JSON.stringify(p1),
  );

  // Return the transformed source
  return transformedSource;
};
